package com.mes.inventory.domain;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.BatchSize;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.ForeignKey;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.JoinColumnOrFormula;
import org.hibernate.annotations.JoinColumnsOrFormulas;
import org.hibernate.annotations.JoinFormula;
import org.springframework.context.annotation.Lazy;

import com.mes.basicdata.domain.Dept;
import com.mes.basicdata.domain.TypesData;
import com.mes.common.domain.BasicModel;

//库房与部门
@Entity()
//@org.hibernate.annotations.Entity(dynamicInsert=true,dynamicUpdate=true)
@Table(name = "I_WAREHOUSE_DEPT")
//@BatchSize(size=10)
//@Lazy(value=true)
//@Cache(usage=CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class WarehouseDept extends BasicModel{
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1238916827985900163L;

	@Id
	@GenericGenerator(name = "uniqueId", strategy = "assigned")
	@Column(name = "UNIQUEID")
	private String uniqueId;	
	
	@Column(name="WAREHOUSEID",length=50)
	protected String warehouseUid; 
	
	@ForeignKey(name="null")
	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumn(name="WAREHOUSEID",insertable=false,updatable=false)
	protected Warehouse warehouse;
	
	@Column(name="DEPTID",length=50)
	protected String deptUid;
	
	@ForeignKey(name="null")
	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumn(name="DEPTID",insertable=false,updatable=false)
	protected Dept dept;
	
	@Column(name="BUSINESS_TYPE",length=50)
	protected String businessType;
	

	public String getUniqueId() {
		return uniqueId;
	}

	public void setUniqueId(String uniqueId) {
		this.uniqueId = uniqueId;
	}

	public String getWarehouseUid() {
		return warehouseUid;
	}

	public void setWarehouseUid(String warehouseUid) {
		this.warehouseUid = warehouseUid;
	}

	public Warehouse getWarehouse() {
		return warehouse;
	}

	public void setWarehouse(Warehouse warehouse) {
		this.warehouse = warehouse;
	}

	public String getDeptUid() {
		return deptUid;
	}

	public void setDeptUid(String deptUid) {
		this.deptUid = deptUid;
	}

	public Dept getDept() {
		return dept;
	}

	public void setDept(Dept dept) {
		this.dept = dept;
	}

	public String getBusinessType() {
		return businessType;
	}

	public void setBusinessType(String businessType) {
		this.businessType = businessType;
	}

	@Override
	public String getUuid() {
		// TODO Auto-generated method stub
		return this.getUniqueId();
	}

	@Override
	public void setUuid(String uuid) {
		// TODO Auto-generated method stub
		this.setUniqueId(uuid);
	}
	
	

}
